﻿using Microsoft.Extensions.Caching.StackExchangeRedis;
using Microsoft.Extensions.Options;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Caching.StackExchangeRedis;

namespace My.RedisUtils
{
    public class MyRedis : AbpRedisCache
    {
        public MyRedis(IOptions<RedisCacheOptions> optionsAccessor)
            : base(optionsAccessor)
        {
        }



        public async Task LPushListAsync(string keys, string value)
        {
            keys = Check.NotNull(keys, nameof(keys));

            await RedisDatabase.ListLeftPushAsync(keys, value);
        }


        public async Task<RedisValue> RPopListAsync(string key)
        {
            return await RedisDatabase.ListRightPopAsync(key);
        }

        public async Task<long> ListLengthAsync(string key)
        {
            return await RedisDatabase.ListLengthAsync(key);
        }

    }
}
